const app = getApp();
Page({
    onShareAppMessage() {
        return {
            title: 'swiper',
            path: 'page/component/pages/swiper/swiper'
        }
    },

    data: {
        swiperList: [],
        filmLIst:[],
    },
    onLoad() {
        this.getSwiperList()
        this.getFilmList()
    },
    getSwiperList() {
        app.get('/film/banners').then(res => {
            this.setData({
                swiperList: res.data
            });
        }).catch(err => {
            wx.showToast({
                title:err.msg,
            })
        })
    },
    getFilmList(type=1){
       let index={type}
        app.get('/film/list',index).then(res=>{
            this.setData({
                filmList:res.data
            })
        }).catch(err=>{
            wx.showToast({
                title: err.msg,
              })
        })
    },
    onChange(event) {
        let type = event.detail.name
        this.getFilmList(type);
      },
})